<%@ page language="java" import="java.util.*" pageEncoding="Utf-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>修改信息</title>
<link rel="stylesheet" href="${pageContext.request.contextPath}/common/style/qdh.css" type="text/css" media="screen" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/common/style/member.css" type="text/css" media="screen" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/common/src/css/jscal2.css" type="text/css" media="screen" />
<script type="text/javascript" src="${pageContext.request.contextPath}/common/js/jquery-1.7.2.min.js"></script>
<script src="${pageContext.request.contextPath}/common/src/js/jscal2.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/common/src/js/lang/cn.js" type="text/javascript"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/common/js/formvalidator.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/common/js/formvalidatorregex.js"></script>

<script type="text/javascript">
	$(function(){
	$.formValidator.initConfig({formid:"form",autotip:true,isformpost:false,onsuccess:function(){
			var params = $("#form").serialize();
					$.ajax({
				   type: "POST",
				   dataType:"json",
				   data:params,
				   url: "${pageContext.request.contextPath}/view/member/editUser.action",
				   success: function(data){
				   var data= data;
				   	if(data.success){
				   	alert("更新成功");
				   	location=location;
				   	}
				   else{
				   alert("更新失败，请检查数据");
				   }
				   }})
			return false;
		}});
		$("#email").formValidator({empty:true,onshow:"请输入E-mail",onfocus:"E-mail格式错误",oncorrect:"E-mail格式正确"}).regexValidator({regexp:"email",datatype:"enum",onerror:"E-mail格式错误"});
		$("#mobile").formValidator({empty:true,onshow:"请输入手机号码",onfocus:"请输入手机号码",oncorrect:"手机号码格式正确"}).regexValidator({regexp:"mobile",datatype:"enum",onerror:"手机号码格式错误"});
		$("#ldnum").formValidator({empty:true,onshow:"请输入身份证号码",onfocus:"请输入身份证号码",oncorrect:"身份证号码格式正确"}).regexValidator({regexp:"idcard",datatype:"enum",onerror:"身份证号码格式错误"});

})

</script>
</head>
<body>
<div id="wrap">
	<s:include value="header.jsp"/>
	<div id="container">
		<div class="fl membersiderbox">
			<h1>用户中心</h1>
			<div class="mleft">
				<s:include value="mleft.jsp"/>
			</div>
		</div>
		<div class="fr membermain">
			<div class="mright">
				<div class="usercommonform">
					<form id="form" >
						<input type="hidden" name="member.id" value="${member.id}"/>	
						<input type="hidden" name="memberInfo.memberId" value="${member.id}"/>				
						<ul>
							<li><strong>用户名：</strong>${member.name}</li>
							<li><strong>真实姓名：</strong><input type="text" class="minput1" name="memberInfo.realName" id="realName" value="${memberInfo.realName}"/></li>
							<li><label><strong>邮箱：</strong><input type="text" value="${member.email}" class="minput1" id="email" name="member.email">
							</label></li>
							<li><strong>性别：</strong>
							<s:if test="memberInfo.sex==1">
							<label><input type="radio" name="memberInfo.sex" checked="checked" value="1" id="sex"/>女</label>
							<label><input type="radio" name="memberInfo.sex" value="0" id="sex"/>男</label>
							</s:if>
							<s:else>
							<label><input type="radio" name="memberInfo.sex" value="1" id="sex"/>女</label>
							<label><input type="radio" name="memberInfo.sex" checked="checked"  value="0" id="sex"/>男</label>
							</s:else>
							</li>
							<li><label>
							<strong>出生日期：</strong>
							<input type="text" class="minput1" id="birthday" name="memberInfo.birthday" value="${memberInfo.birthday}"/>
							<script type="text/javascript">
								Calendar.setup({
									weekNumbers: true,
									inputField : "birthday",
									trigger    : "birthday",
									dateFormat: "%Y-%m-%d",
									minuteStep: 1,
									onSelect   : function() {this.hide();}
								});
							</script>
							</label></li>							
							<li><strong>手机：</strong><input type="text" class="minput1" name="memberInfo.mobile" id="mobile" value="${memberInfo.mobile}"/></li>
							<li><strong>身份证号码：</strong><input type="text" class="minput1" name="memberInfo.ldnum" id="ldnum" value="${memberInfo.ldnum}"/></li>
							<li><strong>住址：</strong><input type="text" class="minput1" name="memberInfo.address" id="address" value="${memberInfo.address}"/></li>
							<li><strong></strong><input type="submit" class="mbtn" value="确定" id="editSubmit"/></li>							
						</ul>
					</form>
				</div>
			</div>
		</div>
		<div class="clr"></div>        
	</div>
	
    <div class="mt15"></div>
	<s:include value="../footer.htm"/>
</div>
</body>
</html>
